class PersonIterator {
    constructor(people) {
        this.people = people;
        this.index = 0;
    }
    next() {
        if (this.index < this.people.length) {
            return { value: this.people[this.index++], done: false };
        } else {
            return { value: undefined, done: true };
        }
    }
    [Symbol.iterator]() {
        return this
    }
}
// 创建 Person 实例
const people = new PersonIterator([
    { name: 'Alice', age: 28 },
    { name: 'Bob', age: 34 },
    { name: 'Charlie', age: 25 }
]);
for (let item of people) {
    console.log(item)
}